package cn.didi.feidi.javabackend.web.waterdeliverapp.controller.orderuser;

import cn.didi.feidi.javabackend.mysql.jpa.order.OrderUser;
import cn.didi.feidi.javabackend.mysql.jpa.response.ApiResponse;
import cn.didi.feidi.javabackend.mysql.jpa.waterDeliver.WaterDeliver;
import cn.didi.feidi.javabackend.server.waterdeliver.service.WaterDeliverService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2017/7/16.
 */
@RestController
@RequestMapping("orderWaterDeliver")
public class OrderUserController {

    @Autowired
    WaterDeliverService waterDeliverService;

    @RequestMapping("orderTaking")
    public ApiResponse<String> orderTaking(String orderId, String waterDeliverId){
        //根据orderId从redis中找到相应OrderUser，并添加送水工id与更新状态(用户app)
        waterDeliverService.orderTaking(orderId, waterDeliverId);
        ApiResponse<String> response = new ApiResponse<>("0", "success");
        return response;
    }

    @RequestMapping("balance")
    public ApiResponse<String> balance(String orderId){
        //根据orderId从redis中找到相应OrderUser，得到送水工
        return null;
    }
}
